// ANES24PilotPubOp
log using ANES24PilotPubOp.log, replace
use "C:\Users\sbstjp\OneDrive - Cardiff University\anes_pilot_2024_dta_20240319.dta" // American National Election Study 2024 Pilot Study, March 19, 2024 Version. Date accessed: March 09, 2025.

keep if sample_type == 1 // Only keep those respondents with proper weight, as advised in codebook

//Demographic items
*Delete missing values and rename
replace ideology_lcself= . if inlist(ideology_lcself, -1, -7) 
rename ideology_lcself libconsp
rename gender FemaleGender

*Generate dummies
gen Graduate=. 
replace Graduate=0 if inrange(educ, 1, 4) 
replace Graduate=1 if inlist(educ, 5, 6)

gen BIPOC=. 
replace BIPOC=0 if race==1
replace BIPOC=1 if inrange(race, 2, 7)

*Delete skipped responses
replace group_antifa= . if inlist(group_antifa, -7, 999)

*Generate a dummy variable for raceadvantage
gen raceadwhite=. 
replace raceadwhite=1 if raceadvt_white==3 & raceadvt_whitestr==1
replace raceadwhite=2 if raceadvt_white==3 & raceadvt_whitestr==2
replace raceadwhite=3 if raceadvt_white==3 & raceadvt_whitestr==3
replace raceadwhite=4 if raceadvt_white==2
replace raceadwhite=5 if raceadvt_white==1 & raceadvt_whitestr==3
replace raceadwhite=6 if raceadvt_white==1 & raceadvt_whitestr==2
replace raceadwhite=7 if raceadvt_white==1 & raceadvt_whitestr==1

// The results
tab school_gender [aweight=weight]
tab school_gender if libconsp < 4 [aweight=weight]
tab school_gender if libconsp > 4 [aweight=weight]
tab school_gender if Graduate==0 [aweight=weight]
tab school_gender if Graduate==1 [aweight=weight]
tab school_gender if BIPOC==0 [aweight=weight]
tab school_gender if BIPOC==1 [aweight=weight]
tab school_gender if FemaleGender==1 [aweight=weight]
tab school_gender if FemaleGender==2 [aweight=weight]
tab school_gender if age<35 [aweight=weight]
tab school_gender if age>=35 & age<=59 [aweight=weight]
tab school_gender if age>59 [aweight=weight]

tab trans_health  [aweight=weight]
tab trans_health  if libconsp < 4 [aweight=weight]
tab trans_health  if libconsp > 4 [aweight=weight]
tab trans_health  if Graduate==0 [aweight=weight]
tab trans_health  if Graduate==1 [aweight=weight]
tab trans_health  if BIPOC==0 [aweight=weight]
tab trans_health  if BIPOC==1 [aweight=weight]
tab trans_health  if FemaleGender==1 [aweight=weight]
tab trans_health  if FemaleGender==2 [aweight=weight]
tab trans_health  if age<35 [aweight=weight]
tab trans_health  if age>=35 & age<=59 [aweight=weight]
tab trans_health  if age>59 [aweight=weight]

tab police_number  [aweight=weight]
tab police_number  if libconsp < 4 [aweight=weight]
tab police_number  if libconsp > 4 [aweight=weight]
tab police_number  if Graduate==0 [aweight=weight]
tab police_number  if Graduate==1 [aweight=weight]
tab police_number  if BIPOC==0 [aweight=weight]
tab police_number  if BIPOC==1 [aweight=weight]
tab police_number  if FemaleGender==1 [aweight=weight]
tab police_number  if FemaleGender==2 [aweight=weight]
tab police_number  if age<35 [aweight=weight]
tab police_number  if age>=35 & age<=59 [aweight=weight]
tab police_number  if age>59 [aweight=weight]

tab raceadwhite [aweight=weight]
tab raceadwhite if libconsp < 4 [aweight=weight]
tab raceadwhite if libconsp > 4 [aweight=weight]
tab raceadwhite if Graduate==0 [aweight=weight]
tab raceadwhite if Graduate==1 [aweight=weight]
tab raceadwhite if BIPOC==0 [aweight=weight]
tab raceadwhite if BIPOC==1 [aweight=weight]
tab raceadwhite if FemaleGender==1 [aweight=weight]
tab raceadwhite if FemaleGender==2 [aweight=weight]
tab raceadwhite if age<35 [aweight=weight]
tab raceadwhite if age>=35 & age<=59 [aweight=weight]
tab raceadwhite if age>59 [aweight=weight]

tab group_blm  [aweight=weight]
tab group_blm  if libconsp < 4 [aweight=weight]
tab group_blm  if libconsp > 4 [aweight=weight]
tab group_blm  if Graduate==0 [aweight=weight]
tab group_blm  if Graduate==1 [aweight=weight]
tab group_blm  if BIPOC==0 [aweight=weight]
tab group_blm  if BIPOC==1 [aweight=weight]
tab group_blm  if FemaleGender==1 [aweight=weight]
tab group_blm  if FemaleGender==2 [aweight=weight]
tab group_blm  if age<35 [aweight=weight]
tab group_blm  if age>=35 & age<=59 [aweight=weight]
tab group_blm  if age>59 [aweight=weight]

tab group_antifa [aweight=weight]
tab group_antifa if libconsp < 4 [aweight=weight]
tab group_antifa if libconsp > 4 [aweight=weight]
tab group_antifa if Graduate==0 [aweight=weight]
tab group_antifa if Graduate==1 [aweight=weight]
tab group_antifa if BIPOC==0 [aweight=weight]
tab group_antifa if BIPOC==1 [aweight=weight]
tab group_antifa if FemaleGender==1 [aweight=weight]
tab group_antifa if FemaleGender==2 [aweight=weight]
tab group_antifa if age<35 [aweight=weight]
tab group_antifa if age>=35 & age<=59 [aweight=weight]
tab group_antifa if age>59 [aweight=weight]

log close

